//
//  DownloadManager.h
//  MHO
//
//  Created by papo on 4/5/14.
//  Copyright (c) 2014 maihoang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TCBlobDownloadManager.h"
#import "TCBlobDownload.h"

#define kNotificationDownloadSuccess    @"kNotificationDownloadSuccess"
#define kNotificationDownloadFailed     @"kNotificationDownloadFailed"
#define kNotificationRemoveDownload     @"kNotificationRemoveDownload"

@interface DownloadManager : NSObject <TCBlobDownloaderDelegate>
@property (nonatomic, strong) NSMutableArray*   listDownload;

+ (DownloadManager*)sharedManager;
//+ (BOOL)startDownloadFileFromUrl:(NSURL*)url;
//- (BOOL)startDownloadFileFromUrlString:(NSString*)url;
//- (BOOL)startDownloadFileFromUrl:(NSURL*)url;
//- (BOOL)startDownloadFileFromUrl:(NSURL *)url inDirectory:(NSString*)path;
+ (TCBlobDownloader*)startDownload:(Application*)app;
- (TCBlobDownloader*)startDownload:(Application*)app;
- (void)cancelDownloadAtIndex:(int)index;
- (void)pauseDownloadAtIndex:(int)index;
- (void)resumeDownloadAtIndex:(int)index;
- (NSInteger)speedRateAtIndex:(int)index;
- (NSInteger)remainTimeAtIndex:(int)index;
//- (NSInteger)total
- (TCBlobDownloader*)downloadAtIndex:(int)index;
- (NSString*)getDocumentsPath;
- (NSArray*)getAllDownloadFile;

- (NSString*)getAppPath:(Application*)app;

- (BOOL)fileUrlStringExist:(NSString*)url;
- (BOOL)fileUrlExist:(NSURL*)url;
- (void)saveDownload:(TCBlobDownloader*)downloader finish:(BOOL)finish;
- (void)removeDownload:(TCBlobDownloader*)downloader;
- (void)removeAppFromList:(Application*)app ;
- (NSDictionary*)dictForDownload:(TCBlobDownloader*)downloader;
- (NSDictionary*)downloadDictionary;
@end
